package com.chinasofti.zbestadmin.service.impl;

import com.chinasofti.zbestadmin.common.DateUtil;
import com.chinasofti.zbestadmin.dao.model.Product;
import com.chinasofti.zbestadmin.dao.ProductMapper;
import com.chinasofti.zbestadmin.service.IProductService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chinasofti.zbestadmin.web.form.ProductForm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigInteger;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 商品 服务实现类
 * </p>
 *
 * @author zbestadmin
 * @since 2019-05-29
 */
@Service
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements IProductService {

    @Autowired
    private ProductMapper productMapper;

    @Override
    public void inserOneProduct(ProductForm productForm) {

        String formatLong =DateUtil.formatLong(new Date());
        productForm.setProductNumber(formatLong);

        productMapper.insertOneProduct(productForm);
    }

    @Override
    public List<Product> queryAllProduct() {
        List<Product> productList = productMapper.queryAllProduct();
        return productList;
    }
}
